<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
	<meta content="yes" name="apple-mobile-web-app-capable">
	<meta content="black" name="apple-mobile-web-app-status-bar-style">
	<title>审批意见</title>
    <script src="__JS__/zepto.min.js"></script>
    <link href="__CSS__/weui.min.css" rel="stylesheet">
	<link rel="stylesheet" href="__SaleManager__/stylesheets/index.css">
</head>
<body>
	<div class="approveOpionOne">
    <header class = "all_header">
      <a class = "h_back h_back_1" data-back='1' href="javascript:void(0)"><img src="__SaleManager__/images/back_icon.png" alt=""></a>
      <span class = "h_title">审批意见</span>
      <a class = "h_add" href="javascript:void(0)"></a>
    </header>
    <input type='hidden' value='{$appinfo.id}' id='applyId'>
		<div class="weui-panel__bd">
      <a href="javascript:void(0);" class="weui-media-box weui-media-box_appmsg">
        <div class="weui-media-box__hd">
          <img class="weui-media-box__thumb" src="__SaleManager__/images/people.png" alt="">
        </div>
        <div class="weui-media-box__bd">
          <h4 class="weui-media-box__title">{$appinfo.apply_name}</h4>
          <p class="weui-media-box__desc">{$appinfo.apply_time}</p>
        </div> 
        <div class="next_approval"><span>{$appinfo.apply_cstatus}</span></div>
      </a>
    </div>
    <div class="approve_opion_w">
    	<div class="weui-panel__hd">{$appinfo.ctype}</div>
    	<div class = "approval_cont">{$appinfo.apply_content}</div>	
    	<div class="weui-panel__hd approval_tip">审批意见</div>
    	<div class="weui-cells weui-cells_form" style = "margin-top: 0;background:#f8f8f8;">
        <div class="weui-cell">
          <div class="weui-cell__bd">
          <if condition="$myself.role_id eq 7 or ($myself.role_id eq 0 and $appuser.role_id  neq 1)"><textarea class="weui-textarea" placeholder="请输入文本" rows="5" id="reply_content" disabled></textarea>
          <else/><textarea class="weui-textarea" placeholder="请输入文本" rows="5" id="reply_content"></textarea>
          </if>
            
          </div>
        </div>
      </div>
    </div>
    <if condition="$myself.role_id eq 7 or ($myself.role_id eq 0 or ($myself.role_id eq 0 and $appuser.role_id  neq 1) )" >
    	<else/><div class="approval_btn_w">
    	<a href="javascript:;" class="weui-btn weui-btn_primary " data-status='1' data-type='{$appinfo.ctype}'>同意</a>
    	<a href="javascript:;" class="weui-btn weui-btn_warn" data-status='2' data-type='{$appinfo.ctype}'>不同意</a>
    </div>
    </if>
    
	</div>
	<include file="./Application/Home/View/default/SaleManager/layer/popup.html"/>
</body>
<script src = "__SaleManager__/js/androidback.js"></script>
<script src = "__SaleManager__/js/index.js"></script>
<script type="text/javascript">
var sessioncode;
var nosesstion_url;
$(document).on("click",".weui-btn",function(){
	$.ajax({
        url: "",
        type: 'POST',
        data: {'reply_content':$("#reply_content").val(),'reply_status':$(this).attr('data-status'),'applyId':$('#applyId').val(),'ctype':$(this).attr('data-type')},
        async: false,
        cache: false,
       	dataType:"json",
        success: function (returndata) {
       	 	//session失效
       	 	if(returndata.code==2028){
       	 		sessioncode=2028;
       	 		nosesstion_url=returndata.data;
	       	 	$('.weui-dialog__bd').html(returndata.msg);
	     		$('#confirm_dialog').css('display','block');
       	 	}else{
	       	 	$('.weui-dialog__bd').html(returndata.msg);
	     		$('#confirm_dialog').css('display','block');
       	 	}
        		
        },
        error: function (returndata) {
        		$('.weui-dialog__bd').html(returndata.msg);
     		$('#confirm_dialog').css('display','block');
        }
    });
})

$(document).on('click','.weui-dialog__btn_primary',function(){
	if(sessioncode==2028){
		window.location.href=nosesstion_url;
	}else{
		window.location.href='../../approvalRecord.html';
	}
	
})

$(document).on('click','.h_back',function(){
	location.href=document.referrer;
})

</script>
</html>